﻿using System.Collections.Generic;
using System.Linq;
using LINQtoFxCop.Core;
using Microsoft.FxCop.Sdk;

namespace LINQtoFxCop.Flaws.Naming
{
  internal sealed class NamingDoNotNameEnumValuesReserved : FlawsIntrospectionRule
  {
    public NamingDoNotNameEnumValuesReserved()
      : base("NamingDoNotNameEnumValuesReserved")
    { }

    protected override IEnumerable<QueryResult> Query()
    {
      return
        from enumValue in Fields
        where enumValue.DeclaringType is EnumNode &&
              enumValue.Name.Name.ToUpper().Contains("RESERVED")
        select Result(enumValue);
    }
  }
}
